package com.ly.service;

import com.ly.mapper.UserMapper;
import com.ly.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public User queryById(Long id) {
        return this.userMapper.selectByPrimaryKey(id);
    }

    public int deleteById(String id) {
        return this.userMapper.deleteByPrimaryKey(id);
    }

    public int insert(User user) {
        return this.userMapper.insert(user);
    }

    public int update(User user) {
        return this.userMapper.updateByPrimaryKeySelective(user);
    }

    public List<User> userList() {
        return this.userMapper.selectAll();
    }
}
